package com.pureut.system.controller;

import com.pureut.common.core.web.controller.BaseController;
import com.pureut.common.core.web.page.TableDataInfo;
import com.pureut.common.security.annotation.RequiresPermissions;
import com.pureut.system.domain.dto.SysWorkbenchAuditAgentDto;
import com.pureut.system.domain.vo.SysWorkbenchAuditAgentVo;
import com.pureut.system.service.SysWorkbenchAuditAgentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 审核代办控制层
 */
@RestController
@RequestMapping("/sys-workbench-audit-agent")
public class SysWorkbenchAuditAgentController extends BaseController {

    /**
     * 审核代办service
     */
    @Resource
    SysWorkbenchAuditAgentService sysWorkbenchAuditAgentService;

    /**
     * 审核代办分页列表
     * @param sysWorkbenchAuditAgentVo
     * @return
     */
//    @RequiresPermissions("system:auditAgent:list")
    @GetMapping("/list")
    public TableDataInfo list(SysWorkbenchAuditAgentVo sysWorkbenchAuditAgentVo)
    {
        startPage();
        List<SysWorkbenchAuditAgentDto> list = sysWorkbenchAuditAgentService.getList(sysWorkbenchAuditAgentVo);
        return getDataTable(list);
    }

    /**
     * 批量新增审核待办
     */
    @PostMapping("/insertAuditAgent")
    public boolean insertAuditAgent(@RequestBody SysWorkbenchAuditAgentVo sysWorkbenchAuditAgentVo) {
        return sysWorkbenchAuditAgentService.insertAuditAgent(sysWorkbenchAuditAgentVo);
    }

    /**
     * 修改审核代办状态
     */
    @PutMapping("/updateStatus")
    public boolean updateStatus(int status,String receiptNumber,String modelName){
        return sysWorkbenchAuditAgentService.updateStatus(status,receiptNumber,modelName);
    }

    /**
     * 删除审核代办
     */
    @DeleteMapping("/deleteDoc")
    public boolean deleteDoc(String receiptNumber,String modelName){
        return sysWorkbenchAuditAgentService.deleteDoc(receiptNumber,modelName);
    }

}
